/*
 * Copyright (c) 2016- 2020 qolome.com Inc. All Rights Reserved.
 * ProjectName: qolome-knowledge
 * FileName: LazySimpleSingleton.java
 * Author: jiangfeng@qolome.com
 * Date: 2020/2/28 上午11:36
 * LastModified: 2020/02/28 11:36:28
 */

package com.qolome.knowledge.design.pattern.singleton.lazy;

import java.util.Objects;

/**
 * @author Qolome
 * @version V1.0
 * @Description 懒汉简单单例
 * 优点: 节省内存
 * 缺点:性能低
 * @date 2020年 02月28日 11:36:23
 */
public class LazySimpleSingleton {

    private static LazySimpleSingleton instance;
    private LazySimpleSingleton(){};

    public synchronized static LazySimpleSingleton getInstance(){
        if(Objects.nonNull(instance)){
            instance = new LazySimpleSingleton();
        }
        return instance;
    }


}
